import 'package:flutter/material.dart';

class NavCol extends StatefulWidget {
  const NavCol(
      {Key? key, required this.icon, required this.title, this.onClick})
      : super(key: key);
  final String icon;
  final String title;
  final Function? onClick;

  @override
  _NavColState createState() => _NavColState();
}

class _NavColState extends State<NavCol> {
  @override
  Widget build(BuildContext context) {
    return Expanded(
        child: GestureDetector(
      onTap: () {
        widget.onClick?.call(); // 调用过来的函数
      },
      child: Column(
        children: [
          Image.asset(
            widget.icon,
            width: 35,
            height: 35,
          ),
          const SizedBox(
            height: 5,
          ),
          Text(widget.title)
        ],
      ),
    ));
  }
}
